package array;

import java.util.Random;
import java.util.Scanner;

public class ArrayDemo07 {
    public static void main(String[] args) {
        int[] codes = new int[5];
        Scanner sc = new Scanner(System.in);
        Random r = new Random();
        //请用户输入工号
        for (int i = 0; i < codes.length; i++) {
            System.out.println("请你输第" + (i + 1) + "个员工工号：");
            int code = sc.nextInt();
            codes[i] = code;
        }
        //遍历每个员工的工号,进行随机交换
        for (int i = 0; i < codes.length; i++) {
            int index = r.nextInt(codes.length);
            int temp = codes[index];
            codes[index] = codes[i];
            codes[i] = temp;
        }
        for (int i = 0; i < codes.length; i++) {
            System.out.print(codes[i] + " ");
        }
    }
}
